package com.bingxue.edu.management.education.model.resp;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.bingxue.edu.common.enums.ClassCategoryEnum;
import com.bingxue.edu.common.enums.TermEnum;
import com.bingxue.edu.framework.excel.converter.ExcelDictEnumConverter;
import lombok.Data;

/**
 * @author panbo
 * @since 2025/1/16
 */
@Data
public class ClassInfoExportResp {

    @ColumnWidth(20)
    @ExcelProperty(value = "班级id")
    private String id;

    @ColumnWidth(64)
    @ExcelProperty(value = "班级名称")
    private String className;

    @ColumnWidth(12)
    @ExcelProperty(value = "主讲老师")
    private String leadTeacherName;

    @ColumnWidth(12)
    @ExcelProperty(value = "教学年份")
    private Integer classYear;

    @ColumnWidth(12)
    @ExcelProperty(value = "学期", converter = ExcelDictEnumConverter.class)
    private TermEnum term;

    @ColumnWidth(12)
    @ExcelProperty(value = "年级")
    private String grade;

    @ColumnWidth(12)
    @ExcelProperty(value = "科目")
    private String subject;

    @ColumnWidth(12)
    @ExcelProperty(value = "班级分类", converter = ExcelDictEnumConverter.class)
    private ClassCategoryEnum classCategory;

    @ColumnWidth(12)
    @ExcelProperty(value = "校区")
    private String campusName;

    @ColumnWidth(12)
    @ExcelProperty(value = "教室")
    private String classroomName;

    @ColumnWidth(12)
    @ExcelProperty(value = "计划招生")
    private Integer planStudentCount;

    @ColumnWidth(12)
    @ExcelProperty(value = "报名人数")
    private Integer enrollStudentCount;

    @ColumnWidth(12)
    @ExcelProperty(value = "通过人数")
    private Integer passedStudentCount;

    @ColumnWidth(12)
    @ExcelProperty(value = "排课次数")
    private Integer totalLessonCount;

    @ColumnWidth(12)
    @ExcelProperty(value = "已上课数")
    private Integer completedLessonCount;

    public static ClassInfoExportResp of(ClassInfoResp from) {
        ClassInfoExportResp resp = new ClassInfoExportResp();
        resp.setId(from.getId());
        resp.setClassName(from.getName());
        resp.setLeadTeacherName(from.getLeadTeacherName());
        resp.setClassYear(from.getClassYear());
        resp.setTerm(from.getTerm());
        resp.setGrade(from.getGrade());
        resp.setSubject(from.getSubject());
        resp.setClassCategory(from.getClassCategory());
        resp.setCampusName(from.getCampusName());
        resp.setClassroomName(from.getClassroomName());
        resp.setPlanStudentCount(from.getPlanStudentCount());
        resp.setEnrollStudentCount(from.getEnrollStudentCount());
        resp.setPassedStudentCount(from.getPassedStudentCount());
        resp.setTotalLessonCount(from.getTotalLessonCount());
        resp.setCompletedLessonCount(from.getCompletedLessonCount());
        return resp;
    }

}

